package cn.accp.mvc.dao.impl;

import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import cn.accp.mvc.dao.UsersDao;
import cn.accp.mvc.entity.Users;
@Repository("usersDao")
public class UsersDaoImpl extends SqlSessionDaoSupport implements UsersDao {
	@Autowired
	@Override
	public void setSqlSessionFactory(SqlSessionFactory sqlSessionFactory) {
		super.setSqlSessionFactory(sqlSessionFactory);
	}
	@Override
	public boolean regs(Users users) {
		boolean isOK = false;
		int iRet = getSqlSession().insert("regs", users);
		if(iRet != 0){
			isOK = true;
		}
		return isOK;
	}

	@Override
	public Users login(Users users) {
		users =(Users)getSqlSession().selectOne("login",users);
		return users;
	}
}
